package com.zxx.cascommon.base.entity;

import java.io.Serializable;
import java.util.List;

/**
 * 接口请求-分页查询专用实体
 *
 * @author zhoukai
 * @date 2020/5/8 16:53
 */
public class QueryVO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 默认分页-每页最大值
     */
    private static final int MAX_PAGE_SIZE = 10000;

    /**
     * 请求用户UID
     */
    private Long requestUserId;

    /**
     * 请求IP
     */
    private String requestIp;

    /**
     * 请求授权码
     */
    private String token;

    /**
     * 批量操作ID
     */
    private List<String> ids;

    /**
     * 当前页
     */
    private Integer curPage;

    /**
     * 页面大小
     */
    private Integer pageSize;
    /**
     * 排序名称
     */
    private List<String> columns;
    /**
     * 是否升序:默认降序
     */
    private Boolean asc;
    /**
     * 开始时间
     */
    private Long startTime;
    /**
     * 结束时间
     */
    private Long endTime;

    public Integer getCurPage() {
        if (null == curPage || curPage < 1) {
            curPage = 1;
        }
        return curPage;
    }

    public void setCurPage(Integer curPage) {
        if (null == curPage || curPage < 1) {
            curPage = 1;
        }
        this.curPage = curPage;
    }

    public Integer getPageSize() {
        if (null == pageSize || pageSize < 0 || pageSize > MAX_PAGE_SIZE) {
            pageSize = 10;
        }
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public List<String> getColumns() {
        return columns;
    }

    public void setColumns(List<String> columns) {
        this.columns = columns;
    }

    public Boolean getAsc() {
        return asc;
    }

    public void setAsc(Boolean asc) {
        this.asc = asc;
    }

    public Long getStartTime() {
        return startTime;
    }

    public void setStartTime(Long startTime) {
        this.startTime = startTime;
    }

    public Long getEndTime() {
        return endTime;
    }

    public void setEndTime(Long endTime) {
        this.endTime = endTime;
    }

    public List<String> getIds() {
        return ids;
    }

    public void setIds(List<String> ids) {
        this.ids = ids;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public String getRequestIp() {
        return requestIp;
    }

    public void setRequestIp(String requestIp) {
        this.requestIp = requestIp;
    }

    public Long getRequestUserId() {
        return requestUserId;
    }

    public void setRequestUserId(Long requestUserId) {
        this.requestUserId = requestUserId;
    }

    @Override
    public String toString() {
        return "QueryVO{" +
                "requestUserId='" + requestUserId + '\'' +
                ", requestIp='" + requestIp + '\'' +
                ", token='" + token + '\'' +
                ", ids=" + ids +
                ", curPage=" + curPage +
                ", pageSize=" + pageSize +
                ", columns=" + columns +
                ", asc=" + asc +
                ", startTime=" + startTime +
                ", endTime=" + endTime +
                '}';
    }
}